// * 面试管理模块下所有table字段
import {
  interviewArrangementStatus,
  interviewSearchStatus,
  orderStatus,
  approverStatus,
} from './status'

console.log(interviewArrangementStatus, 'interviewArrangementStatus')

// * 面试安排table字段
export const arrangementTableColumn = [
  {
    name: "需求编号",
    value: "needs_code",
    width: "190px",
    render: (h, { row }) => {
      return h('span', {
        class: `
        ${ row.interviewTimeStatus === 1? 'font-color-red' : '' }
        ${ row.closeState  === 1? 'needsFinished': '' }
        ${ row.suspendState  === 1? 'pause': '' }
        ${ row.suspendState === 2? 'restore': '' }
        ${ row.closeState === 2? 'close': '' }
        `
      } , [
        row.interviewTimeStatus === 1? h('span', {
          class: 'circle'
        }, null): null,
        h('span', null, row.needs_code),
        row.reuse === 1? h('span', { class: 'multiplex' }, ''): '',
      ])
    }
  },
  {
    name: "岗位名称",
    value: "positionName",
  },
  {
    name: "姓名",
    value: "surname",
  },
  {
    name: "学历",
    value: "education_code",
  },
  {
    name: "工作年限",
    value: "work_experience",
  },
  {
    name: "候选人面试时间",
    value: "interviewTimeSup",
    width: '140px',
    tooltip: '面试官反馈的时间范围内调整候选人面试时间',
    render: (h, { row, listeners }) => {
      return h('span', {
        class: `table-btn ${ row.state === 4 && row.interviewTimeSup? 'color-pink cursor': 'disabled' }`,
        on: {
          click: function () {
            listeners.click("editInterviewTime");
          },
        },
      }, row.interviewTimeSup || '--' )
    }
  },
  {
    name: "面试官",
    value: "interviewerName",
  },
  {
    name: "面试轮数",
    value: "interview_num",
  },
  {
    name: "安排状态",
    render: (h, { row }) => {
      return h('span', {
        class: `${interviewArrangementStatus[row.state].className}`
      } , [
        h('span', {
          class: 'circle'
        }, null),
        h('span', null, `${interviewArrangementStatus[row.state].label}`)
      ])
    }
  },
  // {
  //   name: "审批状态",
  //   render: (h, { row }) => {
  //     return h('span', {
  //       class: `${approverStatus[row.approverState].className}`
  //     } , [
  //       h('span', {
  //         class: 'circle'
  //       }, null),
  //       h('span', null, `${approverStatus[row.approverState].label}`)
  //     ])
  //   }
  // },
  {
    name: "操作",
    type: "operate",
    fixed: "right",
    width: '120px',
    render: (h, { row, listeners }) => {
      return h('span', {},
      [
        h(
          "span",
          {
            class: "cursor table-btn table-blue-btn",
            on: {
              click: function () {
                listeners.click("onLookDetail");
              },
            },
          },
          "查看"
        ),
        row.state === 1 || row.state === 4?h(
          "span",
          {
            class: `table-btn table-blue-btn ${ [1, 2].includes(row.closeState) ? 'disabled' : 'cursor' }`,
            on: {
              click: function () {
                listeners.click("onCencel");
              },
            },
          },
          "取消面试"
        ): null,
        // row.state === 4? h(
        //   "span",
        //   {
        //     class: "cursor table-btn table-blue-btn color-pink",
        //     on: {
        //       click: function () {
        //         listeners.click("editInterviewTime");
        //       },
        //     },
        //   },
        //   "编辑面试时间"
        // ) : null
      ]);
    },
  },
]

// * 面试查询table字段
export const searchTableColumn = [
  {
    name: "需求编号",
    value: "needs_code",
    width: '190px',
    render: (h, { row, listeners }) => {
      return h('div', {}, [
        h('span', {
          class: `
          ${ row.closeState  === 1? 'needsFinished': '' }
          ${ row.suspendState  === 1? 'pause': '' }
          ${ row.suspendState === 2? 'restore': '' }
          ${ row.closeState === 2? 'close': '' }
          `,
        }, [
          h('span', {}, row.needs_code),
          row.reuse === 1? h('span', { class: 'multiplex' }, ''): '',
        ])
      ])
    }
  },
  {
    name: "岗位名称",
    value: "positionName",
  },
  {
    name: "姓名",
    value: "surname",
  },
  {
    name: "学历",
    value: "education_code",
  },
  {
    name: "工作年限",
    value: "work_experience",
  },
  {
    name: "面试时间",
    value: "interview_time",
    width: '135px',
  },
  {
    name: "面试轮数",
    value: "interview_num",
  },
  {
    name: "面试状态",
    render: (h, { row }) => {
      return h('span', {
        class: `${interviewSearchStatus[row.state].className}`,
      } , [
        h('span', {
          class: 'circle'
        }, null),
        h('span', null, `${interviewSearchStatus[row.state].label}`)
      ])
    }
  },
  {
    name: "审批状态",
    render: (h, { row, listeners }) => {
      return h('span', {
        class: `${approverStatus[row.approverState].className}`,
        on: {
          // click: function () {
          //   listeners.click('onApproveDetail')
          // }
        }
      } , [
        h('span', {
          class: 'circle'
        }, null),
        h('span', null, `${approverStatus[row.approverState].label}`)
      ])
    }
  },
  {
    name: "操作",
    type: "operate",
    width: "150px",
    fixed: "right",
    render: (h, { row, listeners }) => {
      return h('div', {}, [
        h(
          "span",
          {
            class: "cursor table-btn table-blue-btn",
            on: {
              click: function () {
                listeners.click("onLookDetail");
              },
            },
          },
          "查看"
        ),
        [1, 2].includes(row.remind) ? h(
          "span",
          {
            class: "cursor table-btn table-blue-btn",
            on: {
              click: function () {
                listeners.click("onRemind");
              },
            },
          },
          ["面试反馈提醒", "面试审批提醒"][row.remind-1]
        ): '',
      ])
    },
  },
]

// * 订单确认table字段
export const orderTableColumn = [
  {
    name: "需求编号",
    value: "needs_code",
    width: '190px',
    render: (h, { row, listeners }) => {
      return h('div', {}, [
        h('span', {
          class: `
          ${ row.closeState  === 1? 'needsFinished': '' }
          ${ row.suspendState  === 1? 'pause': '' }
          ${ row.suspendState === 2? 'restore': '' }
          ${ row.closeState === 2? 'close': '' }
          `,
        }, [
          h('span', {}, row.needs_code),
          row.reuse === 1? h('span', { class: 'multiplex' }, ''): '',
        ])
      ])
    }
  },
  {
    name: "岗位名称",
    value: "positionName",
  },
  {
    name: "姓名",
    value: "surname",
  },
  {
    name: "学历",
    value: "education_code",
    width: '100px'
  },
  {
    name: "工作年限",
    value: "work_experience",
    width: '80px',
  },
  {
    name: "面试时间",
    value: "interview_time",
  },
  {
    name: "订单接收状态",
    render: (h, { row }) => {
      return h('span', {
        class: `${orderStatus[row.state].className}`
      } , [
        h('span', {
          class: 'circle'
        }, null),
        h('span', null, `${orderStatus[row.state].label}`)
      ])
    }
  },
  {
    name: "操作",
    type: "operate",
    width: "130px",
    fixed: "right",
    render: (h, { row, listeners }) => {
      return h('div', {
        class: 'table-btn-group'
      }, [
        h('span', {
          class: `
           table-btn color-pink ${[1, 2, 3].includes(row.state) || [1, 2].includes(row.closeState) ? 'disabled' : 'cursor'}
          `,
          on: {
            click: function () {
              listeners.click('onReceiveInterView')
            }
          }
        }, '接收'),
        h('span', {
          class: `
           table-btn color-pink ${[1, 2, 3].includes(row.state) || [1, 2].includes(row.closeState) ? 'disabled' : 'cursor'}
          `,
          on: {
            click: function () {
              listeners.click('onRejectInterView')
            }
          }
        }, '拒绝'),
        h('span', {
          class: 'cursor table-btn table-blue-btn',
          on: {
            click: function () {
              listeners.click('onLookDetail')
            }
          }
        }, '查看')
      ], null)
    }
  },
]
